/**
 * Created with IntelliJ IDEA.
 * Description:
 */
public class Demo5 {
    public static void main(String[] args) {
        Object locker1 =new Object();
        Thread t1 =new Thread(()->{
                try {
                    System.out.println("t1等待之前");
                    synchronized (locker1){
                        locker1.wait();
                        System.out.println("t1等待之后");
                    }
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }

        });
        Thread t2 =new Thread(()->{
            try {
                System.out.println("t2等待之前");
                synchronized (locker1){
                    locker1.wait();
                    System.out.println("t2等待之后");
                }
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        Thread t3 =new Thread(()->{
            try {
                Thread.sleep(1000);
                synchronized (locker1){
//                    locker1.notify();
                    locker1.notifyAll();
                }
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        t1.start();
        t2.start();
        t3.start();
    }
}
